package bid.web;

import bid.dao.UserDao;
import bid.dao.impl.UserDaoImpl;
import bid.entity.User;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * @author oldliu
 * @since 1.0
 */
@WebServlet(value = "/userUpdateServlet")
public class UserUpdateServlet  extends HttpServlet {
    UserDao userDao = new UserDaoImpl();
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        long id = Long.parseLong(req.getParameter("id"));

        User user = userDao.get(id);

        req.setAttribute("user",user);

        req.getRequestDispatcher("/updateUser.jsp").forward(req,resp);
    }

}
